package org.nt4b.schemadoc.core;

import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;


@SuppressWarnings("static-access")
public class ProgrammOptions {
    public static final Option URL;
    static {
        final Option opt = OptionBuilder.hasArg(). //
                withDescription("JDBC url string"). //
                isRequired().create("url");
        URL = opt;
    }
    
    public static final Option USERNAME;
    static {
        final Option opt = OptionBuilder.hasArg(). //
                withDescription("username"). //
                isRequired().create("u");
        USERNAME = opt;
    }
    
    public static final Option PASSWORD;
    static {
        final Option opt = OptionBuilder.hasArg(). //
                withDescription("password"). //
                isRequired().create("p");
        PASSWORD = opt;
    }

    public static final Option SCHEMA_NAME;
    static {
        final Option opt = OptionBuilder.hasArg(). //
                withDescription("schema name") //
                .create("s");
        SCHEMA_NAME = opt;
    }
    
    public static final Option RESULT_TYPE;
    static {
        final Option opt = OptionBuilder.hasArg(). //
                withDescription("result Type (xml, documentaion or update)"). //
                isRequired().create("t");
        RESULT_TYPE = opt;
    }
    
    public static final Option TABLES;
    static {
        final Option opt = OptionBuilder.hasArg(). //
                withDescription("comma separated list of tables, for which comments will be extracted"). //
                create("tables");
        TABLES = opt;
    }
    
    public static final Option DOCUMENTED;
    static {
        final Option opt = OptionBuilder. //
                withDescription("only already documented tables (tables which comments at table or column level)"). //
                create("do");
        DOCUMENTED = opt;
    }
    
    public static Options buildOptions() {
        final Options options = new Options();
        options.addOption(URL);
        options.addOption(USERNAME);
        options.addOption(PASSWORD);
        
        options.addOption(RESULT_TYPE);
        options.addOption(TABLES);
        options.addOption(DOCUMENTED);
        
        return options;
    }
}
